# Contributor: wener <wenermail@gmail.com>
# Maintainer: wener <wenermail@gmail.com>
pkgname=fio
pkgver=3.21
pkgrel=0
pkgdesc="Flexible I/O Tester"
options="!check" # Tests break due to missing drand_r
url="https://github.com/axboe/fio"
arch="all"
license="GPL-2.0-only"
makedepends="linux-headers zlib-dev coreutils libaio-dev"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/axboe/fio/archive/fio-$pkgver.tar.gz"
builddir="$srcdir/fio-$pkgname-$pkgver"

case "$CARCH" in
	arm*) ;; # no numactl-dev for arm
	*) makedepends="$makedepends numactl-dev" ;;
esac

build() {
	./configure --prefix=/usr
	make T_TEST_PROGS=
}

check() {
	make test
}

package() {
	make DESTDIR="$pkgdir" install
	mv "$pkgdir"/usr/man "$pkgdir"/usr/share

	mkdir -p "$pkgdir"/usr/share/doc/$pkgname
	for i in README REPORTING-BUGS MORAL-LICENSE; do
		cp -a "$builddir/$i" "$pkgdir/usr/share/doc/$pkgname"
	done
}

sha512sums="3398d70b4e7aff02b4fc3e9be8521e695e76ec0d5094da4fe856aced25efeec495c5632e076a6943b0edbb785177159462b37fdc4717471a479638825ee69566  fio-3.21.tar.gz"
